package test2;

import java.util.Arrays;

public class Test2 {
    public static void main(String[] args) {
        int[] nums = new int[]{2, 5, 4, 6, 1, 7};
        int[] arr = select_sort(nums);
        for (int i : arr) {
            System.out.print(i + " ");
        }
    }

    private static int[] select_sort(int[] nums) {
        int[] arr = Arrays.copyOf(nums, nums.length);
        for (int i = 0; i < arr.length - 1; i++) {
            int min = i;
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[j] < arr[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int tmp = arr[i];
                arr[i] = arr[min];
                arr[min] = tmp;
            }
        }
        return arr;
    }
}
